<?php 
namespace Admin\Controller;

use Think\Controller;
class ImagesController extends BaseController{
	function images(){
		$entryOb=M('wares_entry');
		$arr=$entryOb->where("wares_id={$_GET['id']}")->find();
		$this->assign('arr',$arr);
		$this->display();
	}
	function images_check(){
		$son_imagesOb=M('son_images');
		print_r($_POST);
		$uploadOb = new \Think\Upload();
		$uploadOb->autoSub=false;
		$uploadOb->mimes=array('mimes'=>'image/jpeg','image/png','image/gif');
		$uploadOb->rootPath='./Public/Uploads/';
		$info=$uploadOb->upload($_FILES);
		$num=count($info);
		for ($i=0; $i<$num ; $i++) { 
				$_POST['son_images_name']=$info["$i"]['savename'];
				$re=$son_imagesOb->data($_POST)->add();
		}
		if ($re) {	
			$this->success('添加成功',U('Admin/Lister/lister'));
		}else{
			$this->erroy('添加失败',U('Admin/Images/images'));
		}
	}
} 